/*
 * Copyright (C) 2010-2011 Comcast Cable.  All Rights Reserved.
 */
package com.hercules.android.receiver.model.events;

/**
 * <p>This is a subclass of XREEvent that represents the "onExecExternalResult" event. It defines some properties
 * specific to this event. Note that values of all custom properties are actually stored in the XREEvent#params
 * map.</p>
 *
 * <p><strong>Thread safety:</strong> This class is mutable and not thread safe.</p>
 *
 * @author saarixx, jmn
 * @version 1.0
 */
public class XREApplicationExecExternalResultEvent extends XREApplicationEvent {

    /**
     * <p>Represents the name of the "on exec external result" event.</p>
     *
     * <p>This is a string constant used by the user when setting the name of the event.</p>
     */
    public static final String ON_EXEC_EXTERNAL_RESULT_EVENT_NAME = "onExecExternalResult";

    /**
     * <p>Represents the name used to retrieve the callGUID parameter.</p>
     */
    private static final String CALL_GUID = "callGUID";

    /**
     * <p>Represents the name used to retrieve the value parameter.</p>
     */
    private static final String VALUE = "value";

    /**
     * <p>Creates new instance of {@link XREApplicationExecExternalResultEvent} class.</p>
     */
    public XREApplicationExecExternalResultEvent() {
        // empty constructor
    }

    /**
     * <p>Retrieves the GUID identifying the call.</p>
     *
     * @return the GUID identifying the call
     *
     * @throws IllegalStateException if the requested parameter has wrong type in the parameters map or when params is
     *                               null
     */
    public String getCallGUID() {

        return getTypedParam(CALL_GUID, String.class);
    }

    /**
     * <p>Sets the GUID identifying the call.</p>
     *
     * @param callGUID the GUID identifying the call
     *
     * @throws IllegalStateException if params is null
     */
    public void setCallGUID(String callGUID) {

        setParam(CALL_GUID, callGUID);
    }

    /**
     * <p>Retrieves the result of the external call.</p>
     *
     * @return the result of the external call
     *
     * @throws IllegalStateException if the requested parameter has wrong type in the parameters map or when params is
     *                               null
     */
    public String getValue() {

        return getTypedParam(VALUE, String.class);
    }

    /**
     * <p>Sets the result of the external call.</p>
     *
     * @param value the result of the external call
     *
     * @throws IllegalStateException if params is null
     */
    public void setValue(String value) {

        setParam(VALUE, value);
    }
}

